<?php

class CarOptionDao {

	function findAll() {
		$mdb2 = $GLOBALS['objMDB2'];
		return $mdb2->queryAll("SELECT id,name FROM caroption ORDER BY name ASC;");
	}
	
	function save($name) {
		$mdb2 = $GLOBALS['objMDB2'];
		$stm = $mdb2->prepare('INSERT INTO caroption (name) VALUES(?)', array('text'), MDB2_PREPARE_MANIP);
		if ($stm->execute($name)){
			return true;	
		}
		return false;
	}
	
	function delete($id) {
		$mdb2 = $GLOBALS['objMDB2'];
		if ($mdb2->exec("DELETE from caroption WHERE id=$id;")){
			return true;
		}
		return false;
	}
	
}
?>